using Engine;
using Engine.Graphics;
using Game;

namespace SCIENEW {
    public class ScrapIronItem : MeshItem, IMaterialBlock {
        public ScrapIronItem() : base("ScrapIron") {
            var model = ContentManager.Get<Model>("Models/Campfire");
            m_standaloneBlockMesh.AppendModelMeshPart(model.FindMesh("Ashes").MeshParts[0], BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Ashes").ParentBone) * Matrix.CreateScale(3f), false, false, true, false, Color.White);
        }

        public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
        {
            BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMesh, color, size * 2f, ref matrix, environmentData);
        }

        public override BlockPlacementData GetPlacementValue(SubsystemTerrain subsystemTerrain, ComponentMiner componentMiner, int value, TerrainRaycastResult raycastResult)
        {
            return new BlockPlacementData { Value = value, CellFace = raycastResult.CellFace };
        }

        public Materials GetMaterial() => Materials.Iron;
    }
}